package dataTypes;

import java.util.ArrayList;
import java.util.List;

import javax.jdo.annotations.Element;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

/*
 * index,user name, password, business name, address, type, site link, 
 * photo link, description string, 
 * 
 * type = restaurant, bar, ....
 *    
 */

@PersistenceCapable(detachable = "true")
public class business {

	public business(String userName, String password, String business,
			String address, int type,  String siteLink, String photoLink, String description) {
		super();
		this.userName = userName;
		this.password = password;
		this.business = business;
		this.address = address;
		this.type = type;
		this.siteLink = siteLink;
		this.photoLink = photoLink;
		this.description = description;
		this.deals = new ArrayList<deal>();
	}
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent (mappedBy = "business",defaultFetchGroup="true")
	private List<deal> deals;
	
	@Persistent
	private String userName;
	
	@Persistent
	private	String password; 
	
	@Persistent
	private String business;
	

	@Persistent
	private String address;
	
	@Persistent
	private int type;
	
	@Persistent
	private String siteLink;
	
	@Persistent
	private String photoLink;
	
	@Persistent
	private String description; 
	
	
	public List<deal> getDeals() {
		return deals;
	}
	
	public void setDeals(){
		
	}

	public void addDeal(deal deal) {
		this.deals.add(deal);
	}
	
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getBusiness() {
		return business;
	}

	public void setBusiness(String business) {
		this.business = business;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getSiteLink() {
		return siteLink;
	}

	public void setSiteLink(String siteLink) {
		this.siteLink = siteLink;
	}

	public String getPhotoLink() {
		return photoLink;
	}

	public void setPhotoLink(String photoLink) {
		this.photoLink = photoLink;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}
	
}


